package fr.emn.nuitinfo.model;

import java.util.ArrayList;
import java.util.List;

import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;

import fr.emn.nuitinfo.model.interfaces.IEtape;

@Entity
public class Etape implements IEtape {

    /**
     * 
     */
    private static final long serialVersionUID = 8201944599837550400L;

    @Id
    private long              id;
    private String            enigme;
    private String[]          reponses;
    private String            commentaire;
    private String[]          indices;
    private Lieu 	      lieu;

    private List<String> images;

    public Etape() {
	ObjectifyService.register(getClass());
    }

    public Etape(String enigme, String[] reponses, String commentaire,
	    String[] indices, Lieu lieu) {
	super();
	this.enigme = enigme;
	this.reponses = reponses;
	this.commentaire = commentaire;
	this.indices = indices;
	this.images = new ArrayList<String>();
	this.lieu = lieu;
    }

    public long getId() {
	return id;
    }

    public String getEnigme() {
	return enigme;
    }

    public void setEnigme(String enigme) {
	this.enigme = enigme;
    }

    public String[] getReponses() {
	return reponses;
    }

    public void setReponses(String[] reponses) {
	this.reponses = reponses;
    }

    public String getCommentaire() {
	return commentaire;
    }

    public void setCommentaire(String commentaire) {
	this.commentaire = commentaire;
    }

    public String[] getIndices() {
	return indices;
    }

    public void setIndices(String[] indices) {
	this.indices = indices;
    }
    
    @Override
    public boolean valider(String reponse) {
        return fr.emn.nuitinfo.model.validator.AnswerChecker.checkAnswer(reponse, reponses);
    }
    
    @Override
    public void addImage(String url) {
	images.add(url);
    }

    @Override
    public List<String> getImages() {
	return this.images;
    }

}
